﻿using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ymatou.API.Common;
using Ymatou.ServiceCenter;
using YmatouSeller.NoticeAPI.Model.Response;

namespace YmatouSeller.NoticeAPI.Model.Request
{
    [Resource("sellernotice.iapi.ymatou.com", "api/NoticeManage/GetCountryList", Method.GET, ParameterBuildType.Json)]
    public class GetCountryListRequest : BaseRequestModel<GetCountryListResponse>
    {
        public override string ApiName
        {
            get { return "api/NoticeManage/GetCountryList"; }
        }

        public override bool HttpGet
        {
            get { return true; }
        }

        /// <summary>
        /// 大洲
        /// </summary>
        public string Continent { get; set; }

        /// <summary>
        /// 国家ID
        /// </summary>
        public int CountryID { get; set; }

        /// <summary>
        /// 查询类型(0:查询所有大洲;1:按大洲名查国家信息,2:按国家ID查询国家信息)
        /// </summary>
        public int SelectType { get; set; }

        public override void Validate()
        {
            if (SelectType == 2 && CountryID < 0)
            {
                throw new Ymatou.API.Common.BussniessException("-1", "按国家ID查询时国家ID不能为空");
            }
            base.Validate();
        }
    }
}
